﻿using System.Data;
using Microsoft.ApplicationBlocks.Data;

namespace DataObject.Online
{
    public class OnlineDAL
    {
        public static void Online_Create(OnlineObject o)
        {
            SqlHelper.ExecuteNonQuery(Constants.ConnectionString, "Online_Create",
                                    o.TypeId, o.Priority, o.Name, o.Yahoo, o.YahooName, o.Skype, o.SkypeName, o.PhoneNo, o.Email);
        }

        public static void Online_Update(OnlineObject o)
        {
            SqlHelper.ExecuteNonQuery(Constants.ConnectionString, "Online_Update",
                                    o.OnlineId, o.TypeId, o.Priority, o.Name, o.Yahoo, o.YahooName, o.Skype, o.SkypeName, o.PhoneNo, o.Email);
        }

        public static void Online_Delete(int onlineId)
        {
            SqlHelper.ExecuteNonQuery(Constants.ConnectionString, "Online_Delete", onlineId);
        }

        public static IDataReader Online_GetById(int onlineId)
        {
            return SqlHelper.ExecuteReader(Constants.ConnectionString, "Online_GetById", onlineId);
        }

        public static IDataReader Online_GetByTypeId(int typeId)
        {
            return SqlHelper.ExecuteReader(Constants.ConnectionString, "Online_GetByTypeId", typeId);
        }
    }
}
